# 可变位置参数：函数定义时使用*号，可接收任意数量的位置参数（非关键字参数）
def print_args1(*nums):
    for num in nums:
        print(num)
    print('----print_args1运行结束！------')


def print_args2(a, b, *nums, c):
    print(f'a = {a}; b = {b}; c = {c}')
    print('参数nums的类型', type(nums))
    i = 0
    for num in nums:
        print(f'num[{i}]:{num}')
        i += 1
    print('----print_args2运行结束！------')


# 可变关键字参数：函数定义时使用**号，可接收任意数量关键字参数
def print_kwargs1(**kwargs):
    print('参数kwargs的类型', type(kwargs))
    for key, value in kwargs.items():
        print(f'{key}:{value}')
    print('----print_kwargs1运行结束！------')


def print_kwargs2(a, *nums, b, **kwargs):
    print(f'a = {a}; b = {b}')
    print('参数nums的类型', type(nums))
    print('参数kwargs的类型', type(kwargs))
    i = 0
    for num in nums:
        print(f'num[{i}]:{num}')
        i += 1
    for key, value in kwargs.items():
        print(f'{key}:{value}')
    print('----print_kwargs2运行结束！------')


if __name__ == '__main__':
    # print_args1(1, 2, 3, 4, 5)
    # print_args1('apple', 2, 'blue', True)
    # print_args1()
    # print_args2(1, 2, 'app', 4, 'blue', c=6)
    # print_kwargs1()
    # print_kwargs1(name='cendy', age=18, address='上海')
    print_kwargs2('apple', 1, 'blue', b = 3, name='cendy', age=18, address='上海')
